package com.gdut.simple.model.impl;

import com.gdut.simple.basic.BasicApplication;
import com.gdut.simple.common.RequestCallback;
import com.gdut.simple.data.entity.History;
import com.gdut.simple.data.local.dao.HistoryDao;
import com.gdut.simple.model.IHistoryModel;

import java.util.List;

public class HistoryModelImpl implements IHistoryModel {

    @Override
    public void queryHistory(RequestCallback<List<History>> callback) {
        HistoryDao.queryHistoryList(BasicApplication.getApplication(), callback);
    }

    @Override
    public void querySingleHistory(String title, String url, RequestCallback<History> callback) {
        HistoryDao.querySingleHistory(BasicApplication.getApplication(), title, url, callback);
    }

    @Override
    public long addHistory(History history) {
        return HistoryDao.addHistory(BasicApplication.getApplication(), history);
    }

    @Override
    public long deleteHistory(History history) {
        return HistoryDao.deleteHistory(BasicApplication.getApplication(), history);
    }

    @Override
    public void clear() {
        HistoryDao.clearHistory(BasicApplication.getApplication());
    }
}
